//index.js
//获取应用实例
var app = getApp()
Page({
	data: {
		root:'',
		siteroot:app.setting.siteroot,
		att_url:app.setting.att_url,
		action:'manage/login',
		pagetitle:'首页' + '-' + app.setting.title,
		
	},
	onReady: function (){
		//获得粉丝消息弹窗(需要时开启)
		//this.ShowAuthM = this.selectComponent("#ShowAuthM");
		var fansinfo = wx.getStorageSync('userInfo');
		if(!fansinfo){
			//this.ShowAuthM.show();
		}
	},
	onPullDownRefresh: function (){
		var the=this;
		var opt={};
		the.onLoad(opt);
		setTimeout(function(){
			wx.stopPullDownRefresh()
		},1000);
	},
	onLoad: function (){
		var page=this;
		wx.setNavigationBarTitle({'title':page.data.pagetitle});
		app.util.get(app.access,function(pagedata){
			//console.log('pagedata');console.log(pagedata);
			page.setData({
				pagedata:pagedata,
				action:app.access.action
			});
		});
	},
	info_login:function(e){
		//根据openid为用户登陆，此处尝试获取用户信息
		app.util.getUserInfo(e);
		this.ShowAuthM.hide();
	},
  	click:function(evt){
		//用户点击事件 data.func 为方法名，data.params 为调用参数！
		var data=evt.currentTarget.dataset;
		app.util[data.func](data.params);
	},
	click_tab:function(evt){
		//用户点击事件 data.func 为方法名，data.params 为调用参数！
		var data=evt.currentTarget.dataset;
		app.util.tab(data.params);
	},
	formSubmit:function(event){
		var the = this
		var pagedata = the.data.pagedata
		var value=event.detail.value;
	},
	username:function(e){
		var the = this
		var pagedata = the.data.pagedata
		pagedata.info.username = e.detail
	},
	pwd:function(e){
		var the = this
		var pagedata = the.data.pagedata
		pagedata.info.pwd = e.detail
	},
	post:function(){
		var the = this
		var pagedata = the.data.pagedata
		app.util.post('post',pagedata.info);
	},
	post2:function(){
		var the = this
		var pagedata = the.data.pagedata
		app.util.post('core/member.login/wechat_login/',pagedata.info)
	}
});